/*
    Copyright (C) 2011 Rodrigo Castaño - Hugo Arregui, FuDePAN

    This file is part of the Prot-Filer Library

    Prot-Filer is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Prot-Filer is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Prot-Filer.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef FORMAT_FILER_H
#define FORMAT_FILER_H

#include <string>
#include "prot-filer/compressed_filer.h"
#include "prot-filer/xtc_filer.h"
#include "prot-filer/fragments_filer.h"

#define INTERNAL_READER_FACTORY
#include "prot-filer/reader_factory.h"
#undef INTERNAL_READER_FACTORY

namespace prot_filer
{

class Coord3DReaderFactory : public ReaderFactoryMixin<Coord3DReaderFactory>
{
public:
    Coord3DReader* create(const std::string& s) const
    {
        if (s == "xtc")
        {
            return new XtcReader();
        }
        else if (s == "compressed")
        {
            return new CompressedReader();
        }
        else
        {
            throw "bad format";
        }
    }
};

class Coord3DSeqReaderFactory : public CompressedReaderFactoryMixin<Coord3DSeqReaderFactory, Coord3DSeqReader>
{};

class AnglesReaderFactory : public CompressedReaderFactoryMixin<AnglesReaderFactory, AnglesReader>
{};

class FragmentsAnglesReaderFactory : public ReaderFactoryMixin<FragmentsAnglesReaderFactory>
{
public:
    FragmentsAnglesReader* create(const std::string& s) const
    {
        if (s == "fragments")
        {
            return new FragmentsAnglesReaderImple();
        }
        else
        {
            throw "bad format";
        }
    }
};
}
#endif
